home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 10.asm < prev    next >
Assembly Source File  |  1999-09-06  |  640b  |  16 lines

  1. * 10.asm   Subroutine to convert a-z to A-Z    version 0.00   1.9.97
  2.  
  3.  move.b #'c',d0 ;try various things here
  4.  bsr Upper
  5.  rts
  6.  
  7. * if d0=a-z, convert to A-Z (and ignore non-alphabetic characters)
  8. Upper:
  9.  cmp.b #'a',d0      ;BRA extension .B  means "byte" - max jump 126 bytes
  10.  bcs.s Up_done      ;BRA extension .W  means "word"  - max jump 32766 bytes
  11.  cmp.b #'z'+1,d0    ;use .S where possible, since it's quicker & shorter
  12.  bcc.s Up_done      ;default for forward jumps is .L, so put .S if short
  13.  add.b #'A'-'a',d0  ; Tandem selects .B or .W automatically for backward
  14. Up_done:            ; jumps, so omit .B or .W for backward jumps
  15.  rts
  16.